/*   /\_/\
*   (= ._.)
*   /  >  \>  Author: LJJ
*/
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <climits>
#include <iomanip>  // cout << fixed << setprecision(y) << x << endl;
#include <cmath>
#include <string>
#include <vector>
//#define int long long
#define x first 
#define y second 
using namespace std;
const int N = 1e5 + 10;
int a[N],sum[N];
typedef pair<int,int> PII;
PII p[N];
/* 二维vector数组
vector<vector<char>> g(n,vector<char>(n));
vector<vector<bool>> st(n,vector<bool>(m,false)); 
g.resize(n,vector<char>(m));
st.resize(n,vector<bool>(m,false));
*/
vector<vector<char>> g;
vector<vector<bool>> st;
int n,k;
using namespace std;

bool check(int x)
{
    for(int i = x; i <= n; i++)
    {
        int tol = sum[i] - sum[i - x];
        if(tol <= k) return true;
    }
    return false;
}

void solve()
{
    cin >> n >> k;
    for(int i = 1; i <= n; i++) cin >> a[i];
    for(int i = 1; i <= n; i++) 
    {
        sum[i] = sum[i - 1] + a[i];
    }
    int l = -1;
    int r = n + 1;
    while(l < r)
    {
        int mid = l + r + 1 >> 1;
        if(check(mid)) l = mid;
        else r = mid - 1;
    }
    cout << l << endl;
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr),cout.tie(nullptr);
    int t = 1;
    while(t -- ) solve();
    return 0;
}

